package com.lwj.liwanjia.view.activity.work.shang_jia;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.lwj.liwanjia.R;
import com.lwj.liwanjia.adapter.YongHuFanKuiHomeAdapter;
import com.lwj.liwanjia.base.BaseActivity;
import com.lwj.liwanjia.bean.YongHuFanKuiHomeBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 001 on 2017/9/13.
 */

public class YongHuFanKuiHomeActivity extends BaseActivity implements View.OnClickListener {

    private TextView tv_back;
    private TextView tv_title;
    private RecyclerView mRecyclerView;
    private YongHuFanKuiHomeAdapter homeAdapter;
    private List<YongHuFanKuiHomeBean> homeList;

    @Override
    protected void initView() {

        tv_back = (TextView) findViewById(R.id.tv_left);
        tv_title = (TextView) findViewById(R.id.tv_title);
        mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);

        tv_back.setVisibility(View.VISIBLE);
        tv_title.setVisibility(View.VISIBLE);
        tv_title.setText("用户反馈");
        tv_back.setOnClickListener(this);

    }

    @Override
    protected void initData() {
        //假数据 适配器
        initRecyclerView();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_yong_hu_fan_kui_home;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            //返回
            case R.id.tv_left:
                finish();
                break;
        }
    }

    //假数据 适配器
    private void initRecyclerView() {

        homeList = new ArrayList<>();

        for (int i = 0; i < 20; i++) {
            YongHuFanKuiHomeBean bean = new YongHuFanKuiHomeBean();
            bean.url = "http://img2.imgtn.bdimg.com/it/u=3800068352,1011550228&fm=27&gp=0.jpg";
            homeList.add(bean);

            YongHuFanKuiHomeBean bean02 = new YongHuFanKuiHomeBean();
            bean02.url = "http://img5.imgtn.bdimg.com/it/u=79496187,3042478172&fm=27&gp=0.jpg";
            homeList.add(bean02);

            YongHuFanKuiHomeBean bean03 = new YongHuFanKuiHomeBean();
            bean03.url = "http://img4.imgtn.bdimg.com/it/u=2154942518,2877333822&fm=27&gp=0.jpg";
            homeList.add(bean03);
        }

        LinearLayoutManager manager = new LinearLayoutManager(this);
        mRecyclerView.setLayoutManager(manager);
        homeAdapter = new YongHuFanKuiHomeAdapter(this, homeList);
        mRecyclerView.setAdapter(homeAdapter);
    }
}
